﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class DeskInfoDAL
    {

        public DataTable SelectDataById(int roomId)
        {
            string sql = "select * from DeskInfo where Roomid = @rid and delflag = 0";


            SQLiteParameter[] sQLiteParameters = new SQLiteParameter[]
            {
                new SQLiteParameter("@rid", roomId)
            };

            return SQLiteHelper.ExecuteFill(sql, sQLiteParameters);
        }


        //修改餐桌状态
        public int UpdateDeskState(int deskId, int state)
        {
            string sql = "update DeskInfo set DeskState = @state where deskId = @did";

            SQLiteParameter[] sQLiteParameters = new SQLiteParameter[]
            {
                new SQLiteParameter("@did", deskId),
                new SQLiteParameter("@state", state)
            };
            return SQLiteHelper.ExecuteNonQuery(sql, sQLiteParameters);
        }

    }
}
